package com.his.controller;

import com.his.bean.DzmHisCarePaylog;
import com.his.service.DzmHisCarePaylogService;
import com.his.utils.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController

public class DzmHisCarePaylogController {
    @Autowired
    DzmHisCarePaylogService dzmHisCarePaylogService;
    @GetMapping("getPaylog")
    public ResponseResult getPaylog(){
        List<DzmHisCarePaylog> list= dzmHisCarePaylogService.getPaylog();
        return new ResponseResult(200,"月度支付统计",list);

    }

    @GetMapping("getList")
    public ResponseResult getList(){
        List<DzmHisCarePaylog> list=dzmHisCarePaylogService.getList();
        return new ResponseResult(200,"ok",list);
    }

    @GetMapping("getPayType")
    public ResponseResult getPayType(){
        System.out.println("条形图");
        try {
            List<Map<String,String>> list=dzmHisCarePaylogService.getPayType();
            return new ResponseResult(200,"ok",list);
        }catch (Exception e){
            System.out.println(e);
            return new ResponseResult(500,"error");
        }
    }
    @GetMapping("getRef")
    public ResponseResult getRef(){
        System.out.println("退款记录");
        List<Map<String,String>> list=dzmHisCarePaylogService.getRef();
        return new ResponseResult(200,"查询退款记录",list);
    }
    @GetMapping("getSum")
    public ResponseResult getAdd(){
            Map<String,String> map=dzmHisCarePaylogService.getSum();
        return new ResponseResult(200,"查询收入和",map);
    }
    @GetMapping("getMinus")
    public ResponseResult getMinus(){
        Map<String,String> map=dzmHisCarePaylogService.getMinus();
        return new ResponseResult(200,"查询收入和",map);
    }

}
